<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ReportAvails.aspx.cs" Inherits="ReportAvails" Title="ABC SuperSign - Users" %>
<%@ Register Src="UserAccess.ascx" TagName="UserAccess" TagPrefix="uc1" %>
<%@ Register Src="GlobalAjax.ascx" TagName="GlobalAjax" TagPrefix="uc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Microsoft.Web.Preview" Namespace="Microsoft.Web.Preview.UI.Controls" TagPrefix="cc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_Main" Runat="Server">
<form action="#" runat="server">
<asp:ScriptManager ID="ScriptManager_Avails" runat="server">
</asp:ScriptManager>
<uc1:UserAccess ID="UserAccess1" runat="server" />
<uc2:GlobalAjax ID="ctl_GlobalAjax" runat="server" />
<asp:HiddenField ID="ExportFileName" runat="server" Value="" />

<!-- page title start -->
<h1>
	<span>Reporting: Avails</span>
</h1>
<!-- page title end -->
<!-- Main Content start -->
<div class="mainHolder"> 
<!-- left block start -->
	<div class="leftBlock">
		<h2>
			<span>Report Parameters</span>
		</h2>
		<div class="innerContent">
			<asp:UpdatePanel ID="UpdatePanel_Parameters" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Btn_Reset" EventName="Click" />
            </Triggers>
            <ContentTemplate>
                <div class="row">
                    <asp:Label ID="Lbl_Alerts" runat="server" Visible="false" Text=""></asp:Label>
                </div>
			    <div class="row">
				    <div class="col">
			            <label>Date Range</label>
                        <asp:TextBox ID="TextBox_DateFrom" runat="server" CssClass="aspDateBox"></asp:TextBox>
		                <span>to</span>
                        <asp:TextBox ID="TextBox_DateTo" runat="server" CssClass="aspDateBox"></asp:TextBox>
				    </div>
			    </div>
			</ContentTemplate>
			</asp:UpdatePanel>
            <div class="row">
                <asp:Button ID="Btn_RunReport" runat="server" Text="Run Report" OnClick="Btn_RunReport_Click" OnClientClick="showProgress();" />
                <div class="spacerS"></div>
                <asp:Button ID="Btn_Reset" runat="server" Text="Reset" OnClick="Btn_Reset_Click" />
            </div>
	    </div>
	</div>
<!-- left block end -->
<!-- right block start -->
    <div class="rightBlock">
        <asp:UpdatePanel ID="UpdatePanel_Results" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <h2>
                    <span>Results</span>
                    <asp:Button ID="Btn_ExportCSV" runat="server" Text="Export" CssClass="aspButton"
                        Enabled="false" OnClick="Btn_ExportCSV_Click" />
                    <asp:Button ID="Btn_Print" runat="server" Text="Print" CssClass="aspButton" Enabled="false" />
                    <%--            <input type="button" value="Export CSV" onclick="showIncomplete();"/>
			<input type="button" value="Print" onclick="showIncomplete();"/>--%>
                </h2>
                <div class="innerContent" style="padding-bottom: 10px;">
                    <asp:Label ID="Lbl_Messages" runat="server" Text=""></asp:Label>
                    <div class="reportResults">
                        <asp:GridView ID="GridView_Results" runat="server" CellPadding="4" GridLines="None">
                            <HeaderStyle Font-Size="13px" />
                            <RowStyle HorizontalAlign="Center" />
                        </asp:GridView>
                    </div>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Btn_RunReport" EventName="Click"></asp:AsyncPostBackTrigger>
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <!-- right block end -->
<!-- main content end -->
</DIV>
<!-- export csv popup begins -->
<asp:Panel ID="Panel_ExportCSV" runat="server" Width="300" CssClass="popupPanel">
<div id="exportCSVPopup" class="yesNoAlert">
    <strong>
        <span>Export Report</span>
        <a href="#" class="close">Close</a>
    </strong>
    <div class="inner">
	    <a id="exportCSVLink" href="#">Download Word File</a>
	    <br />
    </div>
</div>
</asp:Panel>
<cc2:DragOverlayExtender ID="DragOverlayExtender_ExportCSV" TargetControlID="Panel_ExportCSV" runat="server" Enabled="true" />
<cc1:DropShadowExtender ID="DropShadowExtender_ExportCSV" runat="server"
    TargetControlID="Panel_ExportCSV" 
    Rounded="false"
    Width="5"
    Opacity="0.25" 
    TrackPosition="true"  />
<!-- export csv popup ends -->
<script type="text/javascript">
	function showExportPopup() {
	    var filePath = "Exports" + "\/" + "<%= ExportFileName.Value %>";
        $('exportCSVLink').setAttribute('href', filePath);
        $('exportCSVPopup').style.display = "block";
    }
    
    function showProgress() {
        var msgLabel = $('<%= Lbl_Messages.ClientID %>');
        if (msgLabel) {
            msgLabel.text = "Please wait.  Attempting to retrieve report results...";
            msgLabel.style.display = "block";
        }
    } 
</script>
</form>

</asp:Content>

